const path = require('path')

const HtmlWebpackPlugin = require('html-webpack-plugin')
//vue 坑， 要先 new vueplugin 视频里无
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
    mode:'development',
    entry:'./src/index.js',
    output:{
        filename:'build.js',
        path: path.join(__dirname,'dist')
    },
    devServer: {
        // contentBase: path.join(__dirname,'dist'),
        port:3000,
        compress:true,
        open:true
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(__dirname,'./src/index.html'),
            filename:'index.html'
        }),
        new VueLoaderPlugin()

    ],
    module:{//配置所有第三方loader 模块
        rules: [
            { test:/\.css$/, use:['style-loader','css-loader'] },
            { test:/\.less$/, use:['style-loader','css-loader','less-loader'] },
            { test:/\.(jpg||png||gif||bmp||jpeg)$/,use:'url-loader?limit=19613&name=[hash:8]-[name].[ext]' },
            { test:/\.(ttf||eot||svg||woff|woff2)$/,use:'url-loader' },
            { test:/\.js$/,use:'babel-loader', exclude: /node_modules/ },
            { test:/\.vue$/, use: 'vue-loader' }
            
        ]

    }
    // resolve: {
    //     alias:{// 修改:设置Vue被导入时候的包的路径
    //         // "vue$":"vue/dist/vue.js"
    //     }
    // }

}